package LeetCode.month02.day36;

public class No3000 {
    public static void main(String[] args) {
        System.out.println(areaOfMaxDiagonal(new int[][]{{6,5},{8,6},{2,10},{8,1},{9,2},{3,5},{3,5}}));
    }
    public static int areaOfMaxDiagonal(int[][] dimensions) {
        int n = dimensions.length;
        int area = 0;
        int len = 0;
        for (int i = 0; i < n; i++) {
            int x = dimensions[i][0];
            int y = dimensions[i][1];
            int l = x*x+y*y;
            if(l>len){
                area = x*y;
                len = l;
            }else if(l==len){
                area = Math.max(area,x*y);
            }
        }
        return area;
    }
}
